package espace_logique;

import espace_physique.*;
import fichiers.Element;
import fichiers.RacineLogique;
import java.awt.*;
import java.io.*;
import javax.swing.*;
import javax.swing.filechooser.FileSystemView;
import javax.swing.tree.*;

public class MyDefaultTreeCellRendererLogique extends DefaultTreeCellRenderer{
    
    private static ImageIcon iconElement;
    private static ImageIcon pdt=new ImageIcon("pdt.jpg");
    private static ImageIcon dossier=new ImageIcon("dossier.jpg");    
    private static JFileChooser jf=new JFileChooser();
    private TreeCellRenderer next;

    
    public MyDefaultTreeCellRendererLogique(TreeCellRenderer next) {
    
        this.next=next;
    }
    
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
        
        DefaultMutableTreeNode t=(DefaultMutableTreeNode)value;
        Element f=(Element)t.getUserObject();
        JLabel valeurLabel=(JLabel) next.getTreeCellRendererComponent(tree,value,sel,expanded,leaf,row,hasFocus);

        if(f.estUnDossier()){
            valeurLabel.setIcon(this.dossier);
        } else if(f==RacineLogique.getRacine()){
            valeurLabel.setIcon(pdt);
        }
         
        return valeurLabel;
    }
    
    
}
